package com.jwsoft.manager.core.dao.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.jwsoft.manager.common.vo.bigScreen.analysisXq.AddressOverviewXqQueryVO;
import com.jwsoft.manager.common.vo.bigScreen.analysisXq.SchoolAddressCountVO;
import com.jwsoft.manager.common.vo.bigScreen.analysisXq.StuEnrollDgxxInVO;
import com.jwsoft.manager.common.vo.bigScreen.analysisXq.StuEnrollXxhxXqnxqVO;
import com.jwsoft.manager.common.vo.eduAddress.EduAddressVO;
import com.jwsoft.manager.common.vo.eduAddress.SchoolAddressQueryVO;
import com.jwsoft.manager.common.vo.eduAddressSchool.EduAddressSchoolQueryVO;
import com.jwsoft.manager.common.vo.eduAddressSchool.EduAddressSchoolSearchVO;
import com.jwsoft.manager.common.vo.eduAddressSchool.EduAddressSchoolVO;
import com.jwsoft.manager.common.vo.eduAddressSchoolAudit.EduAddressSchoolAuditVO;
import com.jwsoft.manager.common.vo.eduAddressTreeInitial.EduAddressTreeInitialVO;
import com.jwsoft.manager.common.vo.eduSchool.SchoolDistrictQueryVO;
import com.jwsoft.manager.common.vo.eduSchool.SchoolDistrictVO;
import com.jwsoft.manager.core.dao.model.EduAddress;
import com.jwsoft.manager.core.dao.model.EduAddressSchool;
import com.jwsoft.manager.core.dao.model.EduAddressSchoolAudit;
import com.jwsoft.manager.core.dao.model.EduAddressTreeInitial;

import java.util.List;

/**
 * 地址学校关联表服务类
 *
 * @author wangtao
 * @since 2022-12-02
 */
public interface EduAddressSchoolService extends IService<EduAddressSchool> {
    List<EduAddressVO> getAddressNo(SchoolAddressQueryVO vo);
    List<SchoolDistrictVO> getSchoolInfo(SchoolDistrictQueryVO vo);
    List<EduAddressVO> getAddress(SchoolAddressQueryVO vo);

    List<StuEnrollXxhxXqnxqVO> getStuEnrollXxhxXqnxq(StuEnrollDgxxInVO vo);

    List<SchoolAddressCountVO> getSchoolAddressCountVO(AddressOverviewXqQueryVO vo);
    //获取学校已关联数据
    List<EduAddressSchoolVO> getAddressByGl(EduAddressSchoolSearchVO vo);
    //获取学校未联数据
    List<EduAddressSchoolVO> getAddressByNoGl(EduAddressSchoolSearchVO vo);

    /**
     * 绑定地址与学校
     *
     * @param addressId 地址id
     * @param schoolId  学校id
     * @return 表主键id
     * @author fangs
     */
    String bound(String addressId, String schoolId);

    /**
     * 解绑地址与学校
     *
     * @param addressId 地址id
     * @param schoolId  学校id
     * @author fangs
     */
    void unbound(String addressId, String schoolId);


    /**
     * 绑定地址和学校关联到edu_address_school
     *  vo
     * @return 表主键
     */
    String boundSchoolAndAddress(EduAddressSchoolAuditVO vo);

    /**
     * 保存edu_address_school表的关联关系
     * 解析好的地址树需要初始化学区关联
     * @param eduAddress 地址数据
     * @param lastNode  最后一个节点信息
     */
    void saveTreeSchoolRelation(EduAddress eduAddress, EduAddressTreeInitialVO lastNode);

    /**
     * 解绑edu_address_school表的关联关系
     * @param addressId  地址主键
     * @param schoolId 学校主键
     */
    void unboundSchoolAndAddress(String addressId, String schoolId);

    /**
     * 学校本年度地址库查询
     * @param vo
     * @return
     */
    List<EduAddressSchool> querySchoolAddressByNowYear(EduAddressSchoolQueryVO vo);


    /**
     * 根据地址id，更新预采集中的预报名状态
     * @param addressId
     */
    void renewalBeforeFlagByAddressId(String addressId);
}
